<?php

use think\migration\Migrator;
use think\migration\db\Column;

class ReportGoodsOut extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('report_goods_out', ['comment' => '出库报表']);
        $table->addColumn('company_id', 'integer', ['comment' => '公司id'])
            ->addColumn('dealer_id', 'integer', ['comment' => '经销商id'])
            ->addColumn('dealer_goods_id', 'integer', ['comment' => '经销商商品id'])
            ->addColumn('dealer_cate_id', 'integer', ['comment' => '经销商分类id'])
            ->addColumn('total_out_num', 'integer', ['comment' => '出库总数量'])
            // 大单位规格ID
            ->addColumn('big_unit_id', 'integer', ['comment' => '大单位规格id'])
            ->addColumn('big_unit_out_num', 'integer', ['comment' => '大单位出库数量'])
            ->addColumn('big_unit_out_value', 'decimal', ['comment' => '大单位出库货值'])
            // 小单位规格ID
            ->addColumn('small_unit_id', 'integer', ['comment' => '小单位规格id'])
            ->addColumn('small_unit_out_num', 'integer', ['comment' => '小单位出库数量'])
            ->addColumn('small_unit_out_value', 'decimal', ['comment' => '小单位出库货值'])
            // 中单位id
            ->addColumn('middle_unit_id', 'integer', ['comment' => '中单位规格id'])
            ->addColumn('middle_unit_out_num', 'integer', ['comment' => '中单位出库数量'])
            ->addColumn('middle_unit_out_value', 'decimal', ['comment' => '中单位出库货值'])
            // 统计时间天
            ->addColumn('time', 'date', ['comment' => '统计时间天'])
            ->create();
    }
}
